<template>
	<gui-page ref="guiPage" :customHeader="true">
		<!-- 导航 -->
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('taskManagement.advancedQuery')" @clickLeftBack="clickLeftBack"
				scanType="0"></nav-bar-custom>
		</template>

		<template v-slot:gBody>
			<view class="distributed">
				<view class="gui-bg-white gui-dark-bg-level-3 gui-padding-x distributed-head">
					<view class="custom-card-title" style="height:50rpx;line-height:50rpx;position: relative;">
						<text class="title-line"></text>
						{{ $t('taskManagement.queryCondition') }}
						<view class="card-rotating card-rotating-top" @click.stop="data.show = !data.show"
							style="position: absolute;right:0rpx;">
							<uni-icons v-if="!data.show" type="bottom" color="#37886C" size="20"></uni-icons>
							<uni-icons v-if="data.show" type="top" color="#37886C" size="20"></uni-icons>
						</view>
					</view>
					<view v-if="data.show">
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ 'cds' +
									$t('taskManagement.taskNo')
								}}：</text>
							<view class="gui-form-body gui-text-right" style="height:70rpx;line-height:70rpx;">
								<input type="text" class="gui-form-input gui-text-right" v-model="data.cdsTaskNo"
									:placeholder="$t('taskManagement.pleaseEnter')" />
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ 'rcs' +
									$t('taskManagement.agvNo')
								}}：</text>
							<view class="gui-form-body gui-text-right">
								<input type="text" class="gui-form-input gui-text-right" v-model="data.rcsTaskNo"
									:placeholder="$t('taskManagement.pleaseEnter')" />
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ $t('taskManagement.agvNo')
								}}：</text>
							<view class="gui-form-body gui-text-right">
								<input type="text" class="gui-form-input gui-text-right" v-model="data.agvNo"
									:placeholder="$t('taskManagement.pleaseEnter')" />
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ $t('taskManagement.tastStatus')
								}}：</text>
							<view class="gui-form-body gui-text-right" style="overflow: visible;">
								<superweiCombox style="text-align: right;" :candidates="data.selectList"
									:placeholder="$t('distributedOut.placeholder')" :isJSON="true" keyName="name"
									@select="select" v-model="data.selectText" :defaultValue="$t('smashRemoval.all')">
								</superweiCombox>
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:200rpx">{{ $t('taskManagement.taskType')
								}}：</text>
							<comboGrid ref="comboGridRef" v-model="data.taskType" :requestParam="data.requestParamType"
								style="width:100%" requestUrl="/api1/iot/open/GetTaskType" :size="999999"
								:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="itemValue"
								:column="data.columnTaskTypeRule.column" bindValue="locationName"
								@setClick="getTaskTypeClick">
							</comboGrid>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text">{{ $t('distributedEnter.date') }}：</text>
							<view class="gui-form-body gui-text-right" @click="dateChoose">
								<view class="gui-form-input gui-text-right" v-if="data.chooseTime.length > 0">
									<text>{{ data.chooseTime[0] }}</text> <text v-if="data.chooseTime[1]"> -
										{{ data.chooseTime[1] }}</text>
								</view>
								<input v-else type="button" class="gui-form-input gui-text-right"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" />
							</view>
						</view>
						<view class="custom-card-itemTwo" style="padding:10rpx 0">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:150rpx">{{ $t('taskManagement.pick-upLocation')
								}}：</text>
							<view class="list gui-form-body gui-text-right">
								<comboGrid ref="comboGridRef" v-model="data.pickProcess" :requestParam="data.requestParam"
									requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRule.column" bindValue="locationName" @setClick="getRuleClick">
								</comboGrid>
								<comboGrid ref="comboGridRef" v-model="data.pickLine" :requestParam="data.requestParamLine"
									requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRuleLine.column" bindValue="locationName" @setClick="getLineClick">
								</comboGrid>
								<comboGrid ref="comboGridRef" v-model="data.pickPosition"
									:requestParam="data.requestParamPosition" requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRulePosition.column" bindValue="locationName"
									@setClick="getPositionClick">
								</comboGrid>
							</view>
						</view>
						<view class="custom-card-itemTwo" style="padding:10rpx 0">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:150rpx">{{
									$t('taskManagement.unloadingPosition') }}：</text>
							<view class="list gui-form-body gui-text-right">
								<comboGrid ref="comboGridRef" v-model="data.unloadingProcess"
									:requestParam="data.requestParam2" requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRule2.column" bindValue="locationName" @setClick="getRuleClick2">
								</comboGrid>
								<comboGrid ref="comboGridRef" v-model="data.unloadingLine"
									:requestParam="data.requestParamLine2" requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRuleLine2.column" bindValue="locationName"
									@setClick="getLineClick2">
								</comboGrid>
								<comboGrid ref="comboGridRef" v-model="data.unloadingPosition"
									:requestParam="data.requestParamPosition2" requestUrl="/api1/iot/open/GetProcessData"
									:placeholder="$t('distributedEnter.placeholderTextChoose')" inputKey="code"
									:column="data.columnRulePosition2.column" bindValue="locationName"
									@setClick="getPositionClick2">
								</comboGrid>
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ $t('distributedEnter.materialCode')
								}}：</text>
							<view class="gui-form-body gui-text-right" style="height:70rpx;line-height:70rpx;">
								<input type="text" class="gui-form-input gui-text-right" v-model="data.materialCode"
									:placeholder="$t('taskManagement.pleaseEnter')" />
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ $t('taskManagement.palletNo')
								}}：</text>
							<view class="gui-form-body gui-text-right" style="height:70rpx;line-height:70rpx;">
								<input type="text" class="gui-form-input gui-text-right" v-model="data.palletNo"
									:placeholder="$t('taskManagement.pleaseEnter')" />
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text"
								style="height:70rpx;line-height:70rpx;width:300rpx">{{ $t('taskManagement.palletType')
								}}：</text>
							<view class="gui-form-body gui-text-right" style="overflow: visible;">
								<superweiCombox style="text-align: right;" :candidates="data.palletTypeList"
									:placeholder="$t('distributedOut.placeholder')" :isJSON="true" keyName="name"
									@select="select" v-model="data.palletType" :defaultValue="$t('smashRemoval.all')">
								</superweiCombox>
							</view>
						</view>
						<view class="gui-form-item gui-border-b">
							<text class="gui-form-label gui-secondary-text" style="width:300rpx">{{
								$t('taskManagement.priority') }}：</text>
							<view class="gui-form-body gui-text-right" style="overflow: visible;">
								<superweiCombox style="text-align: right;" :candidates="data.priorityList"
									:placeholder="$t('distributedOut.placeholder')" :isJSON="true" keyName="name"
									@select="select" v-model="data.priority" :defaultValue="$t('smashRemoval.all')">
								</superweiCombox>
							</view>
						</view>
					</view>
					<!-- 按钮 -->
					<view class="gui-form-item gui-border-b gui-flex gui-justify-content-center">
						<view class="gui-flex gui-space-between gui-align-items-center"
							style="width: 100%;height: 100rpx;">
							<button type="default" class="gui-button gui-button-mini gui-bg-black4 gui-noborder"
								style="width:200rpx;" @click="reset">
								<text class="gui-block gui-color-black gui-button-text-mini gui-icons">{{
									$t('distributedEnter.reset') }}</text>
							</button>
							<button type="default" class="gui-button gui-button-mini gui-bg-blue gui-noborder"
								style="width:200rpx;" @click="search">
								<text class="gui-block gui-color-white gui-button-text-mini gui-icons">{{
									$t('taskManagement.inquire') }}</text>
							</button>
							<button type="default" class="gui-button gui-button-minigui-noborder"
								style="width:200rpx;background-color:#ff6c00;border:#ff6c00 1px solid !important;"
								@click="returnPage">
								<text class="gui-block gui-color-white gui-button-text-mini gui-icons">{{
									$t('translationImage.close') }}</text>
							</button>
						</view>
					</view>
				</view>
				<!-- 内容 -->
				<scroll-view :show-scrollbar="false" :scroll-y="true" class="scroll" @scrolltolower="scrolltolowerFn">
					<view style="height: 15rpx"></view>
					<view class="card-boxCustom" v-for="(x, i) in data.list" @click="goPage(x)" :key="i">
						<view class="card-head">
							<text>{{ $t('taskManagement.taskNo') }}：{{ x.taskCode }}</text>
							<gui-tags v-if="x.taskStatusStr == '未完成'" :text="$t('taskManagement.inExecution')"
								:customClass="['gui-transparent-bg', 'gui-color-blue']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#008AFF"></gui-tags>
							<gui-tags v-else-if="x.taskStatusStr == '已完成'" :text="$t('distributedEnter.statusOk')"
								:customClass="['gui-transparent-bg', 'gui-color-green']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#39B55A"></gui-tags>
							<gui-tags v-else-if="x.taskStatusStr == '等待'" :text="$t('taskManagement.await')"
								:customClass="['gui-transparent-bg', 'gui-color-yellow']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#f0ad4e"></gui-tags>
							<gui-tags v-else-if="x.taskStatusStr == '创建'" :text="$t('taskManagement.establish')"
								:customClass="['gui-transparent-bg', 'gui-color-red']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#dd524d"></gui-tags>
							<gui-tags v-else-if="x.taskStatusStr == '提交'" :text="$t('calendar.submit')"
								:customClass="['gui-transparent-bg', 'gui-color-orange']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#37886C"></gui-tags>
							<gui-tags v-else :text="$t('Common.cancel')"
								:customClass="['gui-transparent-bg', 'gui-color-gray']" :width="80" :lineHeight="2.5"
								:size="12" borderColor="#C8C9CC"></gui-tags>
						</view>
						<view class="card-body" style="padding-bottom: 15rpx;">
							<!-- 展开按钮 -->
							<view class="card-rotating card-rotating-top" @click.stop="openClick(i)">
								<!-- <uni-icons type="bottom" color="#9C9C9C" size="20"></uni-icons> -->
								<uni-icons v-if="!data.listShow[i]" type="bottom" color="#9C9C9C" size="20"></uni-icons>
								<uni-icons v-if="data.listShow[i]" type="top" color="#9C9C9C" size="20"></uni-icons>
							</view>
							<!-- card的内容 -->
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.taskType')
									}}：</text>{{ x.businessTaskTypeName }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.palletType')
									}}：</text>{{ x.cartonType }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('finishedInventory.creationTime')
									}}：</text>{{ x.createTime }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.completionTime')
									}}：</text>{{ x.taskCompleteTime }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.transportedQty') }}：</text>{{ x.qty
								}}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.priority')
									}}：</text>{{ x.initPriority }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('mexico.scanType') }}：</text>{{ x.scanType }}
							</view>
							<view class="card-body-item">
								<text class="body-item-title">{{ $t('taskManagement.agvNo') }}：</text>{{ x.robotCode }}
							</view>
						</view>
						<!-- 多个物料的时候有展开,一个的时候没有下面的模块,包括展开按钮都不需要 -->
						<view class="card-body-folding" v-show="data.listShow[i]" v-if="x.listDetails.length > 0">
							<view class="gui-border-t gui-padding" v-for="(item, i) in x.listDetails" :key="i">
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('taskManagement.pick-upLocation')
											}}：</text>{{ item.fromLocationName }}
									</view>
								</view>
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('taskManagement.unloadingPosition')
											}}：</text>{{ item.toLocationName }}
									</view>
								</view>
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('taskManagement.unloadingPositionQty')
											}}：</text>{{ item.existQty }}
									</view>
								</view>
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('distributedEnter.materialCode')
											}}：</text>{{ item.materialCode }}
									</view>
								</view>
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('distributedEnter.materialName')
											}}：</text>{{ item.materialName }}
									</view>
								</view>
								<view class="card-body-item">
									<view class="card-item-50" style="width: 100%;">
										<text class="body-item-title">{{ $t('taskManagement.palletNo')
											}}：</text>{{ item.cartonNo }}
									</view>
								</view>
							</view>
						</view>
					</view>
					<view v-if="data.noticeHooks" class="noticeHooks">
						{{ data.list.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without') }}
					</view>
				</scroll-view>
			</view>
			<calendarCustom ref="calendarCustomRef" @setTime="getTime" :selectTime="data.chooseTime"></calendarCustom>
		</template>
	</gui-page>
</template>

<script setup>
//引入文件
import { ref, reactive, onMounted, computed, watch, toRaw } from "vue";
import pdaScan from '@/hooks/pdaScan.js';
import searchCustom from '@/components/searchCustom';
import calendarCustom from '@/components/calendarCustom';
import superweiCombox from '@/components/superweiCombox';
import openView from '@/components/common/openView';
import comboGrid from "@/components/comboGrid";
import { onShow } from '@dcloudio/uni-app';
import { onBackPress } from '@dcloudio/uni-app';
import { navigate } from '@/utils/routerSkip.js';
import { useStore } from "vuex";
import { basPdaOperationLogFn } from '@/utils/index.js';
import { OPERATION_COMMIT, OPERATION_SCAN } from '@/constant/index.js';
import { DEFAULT_WAREHOUSECODE, DEFAULT_WAREHOUSENAME, DEFAULT_WAREHOUSEID, BIGBARCODER_PRINT } from '@/constant/index.js';
import { getTaskInfo, } from '@/api/api.js'

//JS国际化引入
import { useI18n } from 'vue-i18n';
//注册组件
components: {
	searchCustom,
		superweiCombox,
		calendarCustom,
		openView,
		comboGrid
}
const { t } = useI18n();

let store = useStore();
const { scan } = pdaScan();
let calendarCustomRef = ref(null);

const data = reactive({
	show: true,
	cdsTaskNo: '', //cds任务号
	rcsTaskNo: '',//rcs任务号
	agvNo: '',//AGV编号
	chooseTime: [],//日期
	selectId: '',
	selectText: t('smashRemoval.all'),//任务状态
	selectList: [{
		id: '全部',
		name: t('smashRemoval.all')
	}, {
		id: '完成',
		name: t('translationImage.accomplish')
	}, {
		id: '提交',
		name: t('calendar.submit')
	}, {
		id: '创建',
		name: t('taskManagement.establish')
	}, {
		id: '等待',
		name: t('taskManagement.await')
	}, {
		id: '执行',
		name: t('taskManagement.execute')
	}, {
		id: '取消',
		name: t('calendar.cancel')
	}],
	selectTypeList: [{
		id: '',
		name: t('smashRemoval.all')
	}, {
		id: 'noComplete',
		name: t('translationImage.accomplish')
	},],
	taskType: '', // 任务类型
	taskTypeName: '',
	materialCode: '',//物料代码
	palletNo: '',//托盘号
	palletTypeList: [{
		id: 'SteelCarton48',
		name: t('taskManagement.steelCarton48')
	}, {
		id: 'SteelCarton60',
		name: t('taskManagement.steelCarton60')
	}, {
		id: 'WoodCarton48',
		name: t('taskManagement.woodCarton48')
	}, {
		id: 'WoodCarton60',
		name: t('taskManagement.woodCarton60')
	}],
	palletType: '',//托盘类型
	priorityList: [{
		id: 1,
		name: 1
	}, {
		id: 2,
		name: 2
	}, {
		id: 3,
		name: 3
	}, {
		id: 4,
		name: 4
	}, {
		id: 5,
		name: 5
	}],
	priority: '',//优先级
	pickProcess: '',//取货位置 工序
	pickLine: '',//取货位置 产线
	pickPosition: '',//取货位置 位置
	requestParam: {
		type: '1',
		parentCode: '',
		scanType: ''
	},
	requestParamLine: {
		type: '2',
		parentCode: '',
		scanType: ''
	},
	requestParamPosition: {
		type: '3',
		parentCode: '',
		scanType: ''
	},
	columnRule: {
		column: [{
			label: t('translationImage.process'),
			name: "text",
		}, {
			label: 'code',
			name: "code",
		}]
	},
	columnRuleLine: {
		column: [{
			label: t('newTranslation.productionLineCode'),
			name: "text",
		}, {
			label: t('newTranslation.productionLineName'),
			name: "code",
		}]
	},
	columnRulePosition: {
		column: [{
			label: t('Common.pointPositionCode'),
			name: "text",
		}, {
			label: t('Common.pointPositionName'),
			name: "code",
		}]
	},
	unloadingProcess: '',//取货位置 工序
	unloadingLine: '',//取货位置 产线
	unloadingPosition: '',//取货位置 位置
	requestParam2: {
		type: '1',
		parentCode: '',
		scanType: ''
	},
	requestParamLine2: {
		type: '2',
		parentCode: '',
		scanType: ''
	},
	requestParamPosition2: {
		type: '3',
		parentCode: '',
		scanType: ''
	},
	columnRule2: {
		column: [{
			label: t('translationImage.process'),
			name: "text",
		}, {
			label: 'code',
			name: "code",
		}]
	},
	columnRuleLine2: {
		column: [{
			label: t('newTranslation.productionLineCode'),
			name: "text",
		}, {
			label: t('newTranslation.productionLineName'),
			name: "code",
		}]
	},
	columnRulePosition2: {
		column: [{
			label: t('Common.pointPositionCode'),
			name: "text",
		}, {
			label: t('Common.pointPositionName'),
			name: "code",
		}]
	},
	pickProcessName: '',
	pickLineName: '',
	pickPositionName: '',
	unloadingProcessName: '',
	unloadingLineName: '',
	unloadingPositionName: '',
	requestParamType: {

	},
	columnTaskTypeRule: {
		column: [{
			label: t('Common.pointPositionCode'),
			name: "itemText",
		}, {
			label: t('Common.pointPositionName'),
			name: "itemValue",
		}]
	},
	page: 1,
	size: 20,
	isFinish: false,
	isLoading: false,
	noticeHooks: false, //暂无相关数据标识
	list: [],
	listShow: [],
})

onMounted(() => {
	getSystemTimeRequest()
})

// 时间选择
const getSystemTimeRequest = () => {
	store.dispatch('getSystemTimeRequest')
		.then(res => {
			if (res.length) {
				data.chooseTime.push(res)
				selectTaskFn()
			}
		})
}
const dateChoose = () => {
	calendarCustomRef.value.open();
}
const getTime = (times) => {
	data.chooseTime = times;
}
// 校验 状态的选择事件
const select = (e) => {
	data.selectId = e.id;
}

// 任务类型选择
const getTaskTypeClick = (x) => {
	data.taskType = x.itemValue
	data.taskTypeName = x.itemText
	console.log(data.taskType)
}

// 取货位置选择 工序 产线 位置
const getRuleClick = (e) => {
	data.pickProcess = e.code
	data.columnRuleLine.parentCode = e.code
	data.pickProcessName = e.text
}
const getLineClick = (e) => {
	data.pickLine = e.code
	data.requestParamPosition.parentCode = e.code
	data.pickLineName = e.text
}
const getPositionClick = (e) => {
	data.pickPosition = e.code
	data.pickPositionName = e.text
}
// 放货位置选择 工序 产线 位置
const getRuleClick2 = (e) => {
	data.unloadingProcess = e.code
	data.requestParamLine2.parentCode = e.code
	data.unloadingProcessName = e.text
}
const getLineClick2 = (e) => {
	data.unloadingLine = e.code
	data.requestParamPosition2.parentCode = e.code
	data.unloadingLineName = e.text
}
const getPositionClick2 = (e) => {
	data.unloadingPosition = e.code
	data.unloadingPositionName = e.text
}

const selectTaskFn = () => {
	let start = ''
	let end = ''
	if (data.chooseTime.length > 0) {
		start = data.chooseTime[0] + ' 00:00:00'
		end = data.chooseTime[1] ? data.chooseTime[1] + ' 23:59:59' : (data.chooseTime[0] || '') + ' 23:59:59'
	}
	let parmes = {
		beginTime: start,
		endTime: end,
		agvCode: data.agvNo,//AGV编号
		taskCode: data.cdsTaskNo, //任务编号
		robotTaskCode: data.rcsTaskNo,// RCSABV编号
		taskStatus: data.selectId,// 任务状态
		taskType: data.taskType,// 任务类型，一般是搬运
		fromProcessCode: data.pickProcess,//取货地工序code
		fromLineCode: data.pickLine,//取货地 产线code
		fromLocationCode: data.pickPosition,//取货地位置code
		toProcessCode: data.unloadingProcess,//放货地工序code
		toLineCode: data.unloadingLine,//放货地线别code
		toLocationCode: data.unloadingPosition,//放货地位置code
		materialCode: data.materialCode,//物料号 多个之间用; 隔开
		cartonCode: data.palletNo,//托盘号
		cartonType: data.palletType,//托盘类型 WoodCarton48  48 英寸木托盘 / WoodCarton60  60 英寸木托盘 
		priority: data.priority,//任务优先级
		pageNo: data.page,
		pageSize: data.size,
	}
	data.show=false
	getTaskInfo(parmes).then(res => {
		try {
			let inputParameter = JSON.stringify(parmes)
			let returnParameter = JSON.stringify(res)
			let operationPicture = 'AGV任务管理-高级查询'
			let callInterface = res.rquestUrl
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode: res.code,//返回状态
				errorMessage: res.message,//错误信息
				isPass: res.code == 200 ? 'Y' : 'N',//是否成功 Y N
				operationType: OPERATION_LOOK,
				module: 'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		data.isLoading = false;
		if (res.code == 200) {
			const { items } = res.result;
			data.noticeHooks = false
			if (items.length) {
				items.forEach(x => {
					items.listShow = false
					// 添加展開的按鈕
					x.listDetails = [{
						fromLocationName: x.fromLocationName,
						toLocationName: x.toLocationName,
						existQty: x.existQty,
						materialCode: x.materialCode,
						materialName: x.materialName,
						cartonNo: x.cartonNo,
					}]
				})
			}
			if (data.page == 1) {
				if (items.length == 0) {
					data.noticeHooks = true
				}
				data.list = items
			} else {
				data.list.push(...items)
			}
			data.noticeHooks = data.list.length >= res.result.total;
			data.isFinish = data.list.length >= res.result.total;
		} else {
			uni.showToast({ title: res.message, icon: 'none' })
		}
	})
}

// 小三角展开
const openClick = (index) => {
	data.listShow[index] = !data.listShow[index]
}
// 下拉加载
const scrolltolowerFn = () => {
	if (!data.isFinish && !data.isLoading) {
		data.page++
		data.isLoading = true;
		selectTaskFn()
	}
}

// 重置 查询  关闭

const reset = () => {
	data.agvNo = ''
	data.cdsTaskNo = ''
	data.rcsTaskNo = ''
	data.selectId = ''
	data.taskType = ''
	data.pickProcess = ''
	data.pickLine = ''
	data.pickPosition = ''
	data.unloadingProcess = ''
	data.unloadingLine = ''
	data.unloadingPosition = ''
	data.materialCode = ''
	data.palletNo = ''
	data.palletType = ''
	data.priority = ''
	data.selectId = ''
	data.selectText = t('smashRemoval.all');//t('smashRemoval.all')国际化全部
	data.chooseTime = []
	data.show=true
}
// 查詢
const search = () => {
	selectTaskFn()
}
const returnPage = () => {
	uni.navigateBack({
		delta: 1
	});
}

//导航栏左侧返回
const clickLeftBack = () => {
	navBackCheck()
}
const navBackCheck = () => {
	uni.navigateBack({
			delta: 1
		});
}
//点击物理按键的返回
onBackPress((options) => {
	uni.navigateBack({
			delta: 1
		});
})

</script>

<style scoped lang="scss">
.showHeight {
	height: 400rpx;
	overflow: hidden;
}

.distributed-head {
	border-bottom-left-radius: 16rpx;
	border-bottom-right-radius: 16rpx;
}

.scroll {
	flex: 1;
	height: 2rpx;
}

.distributed {
	display: flex;
	flex-direction: column;
	height: calc(100vh - 88rpx);
	// height: 100vh;
}

.card-box {
	margin: 0 15rpx;
	box-shadow: 0rpx 0rpx 4rpx 0 #A5A5A5;
	background: #fff;
	padding: 30rpx;
	border-radius: 16rpx;
}

.card-item {
	line-height: 60rpx;
}

.card-bottom {
	margin-bottom: 30rpx;
}

.filtrate-item {
	display: flex;
	align-items: center;
	font-size: 32rpx;
	margin-bottom: 20rpx;

	.filtrate-itemLeft {
		height: 32rpx;
		line-height: 32rpx;
		width: 100rpx;
	}

	.filtrate-itemRight {
		border: 2rpx solid #A5A5A5;
		border-radius: 8rpx;
		overflow: hidden;
		line-height: 40rpx;
		width: 300rpx;
	}
}

.card-rotating-top {
	margin-top: 10rpx;
}

.card-selectCustom {
	margin: 0.46875rem 0.625rem;
	box-shadow: 0 0 0.125rem 0 #a5a5a5;
	background: #fff;
	padding: 0.375rem 0.75rem;
	border-radius: 0.5rem;
	position: relative;
	height: 70rpx;
}

.list {
	display: flex;
	flex-direction: row;
}
</style>